package com.study.view;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;

import androidx.appcompat.app.AppCompatActivity;
import androidx.cardview.widget.CardView;

public class MainActivity extends AppCompatActivity implements View.OnClickListener{

    private CardView cvWidget;
    private CardView cvRecycleAction;
    private CardView cvRecycleCaChi;
    private CardView cvbindService;
    public static Context mContext  = null;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        initView();
        mContext = this;
    }

    private void initView() {
        cvWidget = findViewById(R.id.cvWidget);
        cvWidget.setOnClickListener(this);
        cvRecycleAction = findViewById(R.id.cvRecycleAction);
        cvRecycleAction.setOnClickListener(this);
        cvRecycleCaChi = findViewById(R.id.cvRecycleCaChi);
        cvRecycleCaChi.setOnClickListener(this);
        cvbindService = findViewById(R.id.cvbindService);
        cvbindService.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        Intent intent = null;
        switch (v.getId()){
            case R.id.cvWidget:
                intent = new Intent(this,WidgetActivity.class);
                break;

            case R.id.cvRecycleAction:
                intent = new Intent(this,MRecyclerViewActivity.class);
                break;

            case R.id.cvRecycleCaChi:

                break;

            case R.id.cvbindService:
                intent = new Intent(this,LoginActivity.class);
                break;
        }

        if(intent == null){
            return;
        }
        startActivity(intent);
    }
}
